#ifndef X32_H
#define X32_H

#define ADDR_PERIPHERALS							0x80000000
#define PERIPHERAL_INT_VECT_BASE			0x10000000
#define CLOCKS_PER_MS									0xC350
#define LOCK_EXECUTION_LEVEL					0xFFFFFFFF

#define PERIPHERAL_VERSION						11
#define INTERRUPT_MAX									16 
#define INTERRUPT_GLOBAL							16

#define INTERRUPT_CRITICAL						4

#define INTERRUPT_TRAP 								0x00
#define INTERRUPT_DIVISION_BY_ZERO 		0x01
#define INTERRUPT_OVERFLOW 						0x02
#define INTERRUPT_OUT_OF_MEMORY				0x03
#define INTERRUPT_SOFTINT1						0x04
#define INTERRUPT_TIMER1							0x05
#define INTERRUPT_TIMER2							0x06
#define INTERRUPT_BUTTONS							0x07
#define INTERRUPT_SWITCHES						0x08
#define INTERRUPT_PRIMARY_RX					0x09
#define INTERRUPT_PRIMARY_TX 					0x0A

#define PERIPHERAL_UID								0x00
#define PERIPHERAL_PRIMARY_DATA				0x01
#define PERIPHERAL_PRIMARY_STATUS			0x02
#define PERIPHERAL_INSTRCNTR					0x03
#define PERIPHERAL_MS_COUNTER					0x04
#define PERIPHERAL_DISPLAY						0x05
#define PERIPHERAL_SWITCHES						0x06
#define PERIPHERAL_LEDS								0x07
#define PERIPHERAL_BUTTONS						0x08
#define PERIPHERAL_PROCSTATE					0x09
#define PERIPHERAL_INTERRUPT_ENABLE 	0x20
#define PERIPHERAL_SOFTINT1 					0x21
#define PERIPHERAL_TIMER1_PERIOD			0x26
#define PERIPHERAL_TIMER2_PERIOD			0x27

/* about 11 ms per rs232 character */
#define STDOUT_COOLDOWN (INSTRCTIONS_PER_MS / 11)

#endif // X32_H
